package com.xique.api.controller;

import com.xique.api.bean.request.community.*;
import com.xique.api.service.biz.service.ICommunityBizService;
import com.xique.common.core.web.controller.BaseController;
import com.xique.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author shd
 * @create 2022/3/5 13:42
 */
@RestController
@RequestMapping("/community")
public class CommunityController extends BaseController {

    @Autowired
    private ICommunityBizService communityBizService;

    @PostMapping("/v1/communityInfo")
    public AjaxResult communityInfo(@RequestBody CommunityInfoRequest request) {
        return communityBizService.getCommunityInfo(request);
    }

    @PostMapping("/v1/areaList")
    public AjaxResult areaList(@Valid @RequestBody CommunityAreaListRequest request) {
        return communityBizService.getAreaList(request);
    }

    @PostMapping("/v1/buildingList")
    public AjaxResult buildingList(@Valid @RequestBody CommunityBuildingListRequest request) {
        return communityBizService.getBuildingList(request);
    }

    @PostMapping("/v1/houseList")
    public AjaxResult houseList(@Valid @RequestBody CommunityHouseListRequest request) {
        return communityBizService.getHouseList(request);
    }

    @PostMapping("/v1/houseUserList")
    public AjaxResult houseUserList(@Valid @RequestBody CommunityHouseUserListRequest request) {
        return communityBizService.getHouseUserList(request);
    }
}
